switch, private ve static haatası
08.01.2017 - 10:42
hata şu
privatenin üzerine geldiğimde medifier private not allowed here
static üzerine geldiğimde medifier static not allowed here
switch kodunu
TouchImageAdapter sınıfı içerisine yerleştirdiğimde de bu defer
switch le ilgili hata alıyorum.
Teşekkürler
public class MatematikGoster extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.matematikgoster);
ExtendedViewPager mViewPager = (ExtendedViewPager) findViewById(R.id.view_pager);
mViewPager.setAdapter(new TouchImageAdapter());
Bundle extraData = getIntent().getExtras();
String Konuid = extraData.getString("id");
switch (Integer.parseInt(Konuid)){
case 0:
private static int[] images = { R.drawable.fortemelk1, R.drawable.fortemelk2, R.drawable.fortemelk3 };
break;
case 1:
startActivity(new Intent(getApplicationContext(), MainActivity.class));
break;
}
}
static class TouchImageAdapter extends PagerAdapter {
//private static int[] images = { R.drawable.fortemelk1, R.drawable.fortemelk2, R.drawable.fortemelk3 };
@Override
public int getCount() {
return images.length;
}
@Override
public View instantiateItem(ViewGroup container, int position) {
TouchImageView img = new TouchImageView(container.getContext());
img.setImageResource(images[position]);
container.addView(img, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
return img;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
}
13
Görüntülenme
0 Beğeni